window.onload=function(){

	let page = window.location.href.split('/')[window.location.href.split('/').length-1]
	getContent(page)
	.then((data)=>{
		let html = ''
		html+=`<div class="list-group-item">
					<h3 class="list-group-item-heading">
						${data.title}
					</h3>
					<ul class="list-unstyled">
						<li>${data.time}</li>
						<li>${data.url}</li>
					</ul>
					<ul class="hasList">`
		let to = data.to.split(',')
		for(let x of to){
			html+=`<li>${x}</li>`
		}
		html+=`
					</ul>
					
				</div>
				<div class="list-group-item">
						${data.content}
				</div>`
	
		$("#conText").html(html)
	})

}


function getContent(pages){
	return new Promise((resolve,reject)=>{
		$.ajax({
			type:"post",
			url:`/content/getContent/${pages}`,
			dataType:"json",
			success: function (data) {
				if (data.status==1) {
					resolve(data.result)
				}else{
					console.log(data.msg)
				}
			},
			error: function(){
				alert("请求出错");
			}
		});
	})
	
}